﻿using IPCMessage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KInterfaces
{
    /// <summary>
    /// 页面业务处理接口
    /// </summary>
    public interface IPageProcess
    {
        string ID { get; set; }

        string ChineseName { get; set; }

        string PageName { get; set; }

        //bool IsSignatureCompleted { get; set; }

        KJob Job { get; set; }

        /// <summary>
        /// 指示此流程业务是否正在进行中
        /// </summary>
        bool IsRunning { get; }

        UserControl UIControl
        {
            get;
        }

        ShareData SD
        {
            set;
            get;
        }
        void Init();
        void Exit();
        void PlayWelcomeVoice();
        void ApplyLanguage(string code);
        void StartWork();
        void StopWork();
        void AbortWork();
        void Request(IPCRequestMessage msg);
        // Shared data
        T GetValue<T>(string ValueId, object NullReturn = null);
        void SetValue(string ValueId, object NewValue, bool NotExistThenAdd = true);
        void RemoveKey(string key);
        bool ContainsKey(string key);
        // Business data 
        void InitCtrl(int page);
        void InitData();
        void ClearData();
        void UpdateData();
        // Page Process
        void ToNext();
        void ToLast();
        void ToHome();
        void ToEnd();
        void ToAny(string pageName);
        void ToHomeApp();
        void ToDefaultApp();
        void ToAnyApp(string appName);
        void SetTip(string msg, float fontSize);
        event PageChangeEventHandler PageChanged;
        event PageSwitchEventHandler PageSwitched;
        event ModuleChangeEventHandler ModuleChanged;
        event ModuleSwitchEventHandler ModuleSwitched;
        event ClientRequestSentEventHandler RequestMsgSent;
        event PageTipsUpdatedEventHandler PageTipsUpdated;
        void RemoveEvents();
        // administrator event handler
        event TakeAdministratorActionEventHandler TakeAdminAction;
        void OnTakeAdminAction(AdministratorAction action);
        // Language Changed event handler
        event DelegateAppLanguageChanged LanguageChanged;
        void OnLanguageChanged(string code);
    }
}
